package com.magenta.maxoptra.gis.distancematrix;

import com.magenta.maxoptra.gis.GeographicCoordinates;
import com.magenta.maxoptra.gis.commons.Pair;

import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * @author Sergey Grachev
 */
public interface DistanceMatrixDAO {

    boolean addCoordinates(long groupId, Map<Long, Set<GeographicCoordinates>> addedCoordinates);

    boolean removeGroup(long groupId);

    boolean removeCoordinates(long groupId, Map<Long, Set<GeographicCoordinates>> matrices);

    boolean synchronizeCoordinates(long groupId, List<MatrixCoordinates> matrices);

    List<Long[]> getGroupsForUpdating();

    Pair<Set<DistanceMatrixCoordinate>, Set<DistanceMatrixCoordinate>> getNewAndOldCoordinates(long groupId, long matrixId);

    boolean updateState(long groupId, long matrixId, GeographicCoordinates coordinate, boolean isForwardRoute, int state, long providerCid);

    boolean updateStateForCoordinatesForNewCid(long groupId, long newCid, int state);

    boolean removeMatrices(long groupId, Set<Long> removedMatrices);

    boolean resetStatesOfGroup(long groupId);

    boolean isMatrixFullyCalculated(long groupId, long matrixId);

    boolean setMatrixPriority(long groupId, long matrixId, long priority);
}
